import java.util.Arrays;

public class Solution {
    public void merge(int[] nums1, int m, int[] nums2, int n) {
        int i = 0;
        int j = 0;
        int[] tmp = new int[m + n];
        int size = 0;
        while(i < m && j < n){
            if(nums1[i] < nums2[j]){
                tmp[size++] = nums1[i++];
            }else{
                tmp[size++] = nums2[j++];
            }
        }

        while(i == m && j != n){
            tmp[size++] = nums2[j++];
        }

        while(i != m && j == n){
            tmp[size++] = nums1[i++];
        }

        for(i = 0; i < tmp.length; i++){
            nums1[i] = tmp[i];
        }
    }

    public static void main(String[] args) {

    }
}
